MySQL High Availability Solutions


     Lenz Grimmer <lenz@grimmer.com>
                  <
     http://lenzg.net/ | Twitter: @lenzgr
2011-01-26 | San Francisco MySQL Meetup | USA
$ whoami




1998              2002



2008              2010
Agenda
●   High Availability: Concepts &
    Considerations
●   MySQL Replication
●   DRBD / Pacemaker
●   MySQL Cluster
●   Other HA tools/applications
Single MySQL Server

            MySQL Client



   SQL (SELECT, INSERT,
      UPDATE, DELETE)

   MySQL Storage Engines
(InnoDB, MyISAM, PBXT...)



             Disk Storage
(XFS, ReiserFS, JFS, ext3...)
Why HA?
●   Something can and will fail
●   Service Maintenance
●   Downtime is expensive
●   Adding HA to an existing system is complex
Elimination of the SPOF
●   Identify what will fail eventually
     ●   Hard disks
     ●   Fans
●   Consider what might fail
     ●   Application crashes
     ●   OOM-Situations, Kernel-Panics
     ●   Network connections, Cables
     ●   Power supply
What is HA Clustering?
●   Redundancy
●   One system or service goes down → others
    take over
●   IP address takeover, service takeover
●   Ensuring data availability & integrity
●   Not designed for high-performance
High Availability Levels
Rules of High Availability
●   Prepare for failure
●   Aim to ensure that no important data is
    lost
●   Keep it simple, stupid (KISS)
●   Complexity is the enemy of reliability
●   Automate it
●   Test your setup frequently!
HA Components
●   Heartbeat
     ●   Checks that services that are monitored, are alive.
     ●   Can check individual servers, software services,
         networking etc.
●   HA Monitor
     ●   Configuration of the services
     ●   Ensures proper shutdown and startup
     ●   Allows manual control
●   Shared storage / Replication
Split-Brain
●   Communications failures can lead to
    separated partitions of the cluster
●   If those partitions each try and take control
    of the cluster, then it's called a split-brain
    condition
●   If this happens, then bad things will happen
●   Use Fencing or Moderation/Arbitration to
    avoid it
Redundancy Using MySQL Replication




           MySQL Replication
MySQL Replication
●   Unidirectional
●   Statement- or row-based (MySQL 5.1)
●   Built into MySQL
●   Easy to use and set up
●   One Master, many Slaves
●   Asynchronous – Slaves can lag behind
●   New in MySQL 5.5: Semisync Replication
MySQL Replication (2)
●   Master maintains Binary logs & index
●   Replication on Slave is single-threaded
    http://forge.mysql.com/wiki/ReplicationFeatures/ParallelSlave
●   No automated fail-over
●   No heartbeat, no monitoring
●   New in 5.5: replication heartbeat
MySQL Replication - Overview

        Read & Write


            Web/App
             Server
                                                                       Write

                                                 Relay
                                                  Log



                  mysqld                                                SQL
                                                       I/O
                                                                       Threa
                                                     Thread
                                                                         d
                       Index &
                       Binlogs

Data

                                 Replication                  Binlog           Data

                                               mysqld

       MySQL Master                                       MySQL Slave
Statement-based Replication
●   Pro
     ✔   Proven (around since MySQL 3.23)
     ✔   Smaller log files
     ✔   Auditing of actual SQL statements
     ✔   No primary key requirement for replicated tables
●   Con
     ✗   Non-deterministic functions and UDFs
     ✗   LOAD_FILE(), UUID(), CURRENT_USER(),
         FOUND_ROWS()
         (but RAND() and NOW() work)
Row-based Replication
●   Pro
     ✔   All changes can be replicated
     ✔   Similar technology used by other RDBMSes
     ✔   Fewer locks required for some INSERT, UPDATE or
         DELETE statements
●   Con
     ✗   More data to be logged
     ✗   Log file size increases (backup/restore implications)
     ✗   Replicated tables require explicit primary keys
     ✗   Possible different result sets on bulk INSERTs
Replication Topologies

Master > Slave                          Master > Slaves




Master > Slave > Slaves            Masters > Slave (Multi-Source)




                                         Ring (Multi-Master)
Master < > Master (Multi-Master)
Master-Master Replication
●   Two nodes are both master and slave to
    each other
●   Useful for easier failover
●   Not suitable for (write) load-balancing
●   Don't write to both masters
    simultaneously!
●   Use Sharding or Partitioning instead
    (e.g. MySQL Proxy)
MySQL Replication as a HA Solution
●   What happens if the Master fails?
●   What happens if the Slave fails?
●   This doesn’t sound like High Availability!
●   Yes!
●   Replication is only part of a HA
    configuration
Pacemaker (Linux-HA)
●   Supports 2 or more Nodes (v2)
●   Resource monitoring (Apps and HW)
●   Active fencing mechanism (STONITH)
●   Node failure detection in seconds
●   Supports many applications (incl. MySQL)
●   http://clusterlabs.org/
●   http://www.clusterlabs.org/wiki/Load_Balanced_MySQL_Replicated_Cluster
●   http://www.clusterlabs.org/wiki/DRBD_MySQL_HowTo
Replication & HA
●   Combined with Pacemaker
●   Virtual IP takeover
●   Slave gets promoted to Master
●   Side benefits: load balancing & backup
●   Can be tricky to fail back
●   No automatic conflict resolution
●   Proper failover needs to be scripted
Redundancy With Disk Replication




           Disk Replication
DRBD
●   Distributed Replicated Block Device
●   “RAID-1 over network”
●   Synchronous/asynchronous block replication
●   Automatic resynchronisation
●   Application-agnostic
●   Can mask local I/O-Errors
●   Active/passive configuration
●   Dual-primary mode (requires cluster file sytem
    like GFS or OCFS2)
●   http://drbd.org/
DRBD in Detail
●   DRBD replicates data blocks between to
    block devices
●   DRBD can be combined with Linux-HA and
    other HA solutions
●   MySQL runs normally                    Applications


    on primary node
●   MySQL is not active on   Active Node   Virtual IP     Passive Node


    the secondary node
●   DRBD is Linux only                            DRBD
Redundancy Using Shared Storage
Replication vs. SAN
●   Data Consistency / Integrity
●   Synchronous vs. asynchronous
●   SAN can become the SPOF
●   Cold caches
●   “Split brain”-Situations
●   SAN/NAS I/O Overhead
Redundancy with MySQL Cluster
MySQL Cluster
●   “Shared-nothing”-Architecture
●   Automatic partitioning
●   Distributed fragments
●   Synchronous replication
●   Fast, automatic fail-over of data nodes
●   Automatic resynchronisation
●   Transparent to MySQL applicationen
●   Supports transactions
●   http://mysql.com/products/database/cluster/
MySQL Cluster
●   In-memory indexes
●   Not suitable for all query patterns
    (cross-table JOINs, range scans)
●   No support for foreign keys
●   Not suitable for long running transactions
●   Network latency crucial
●   Can be combined with MySQL replication
    (RBR)
MySQL High Availability Solutions
MySQL Cluster & Replikation
●   MySQL Cluster
     ●   Easy failover from one MySQL node to another
     ●   Scaling write load using multiple SQL nodes
●   Asynchronous replication from Cluster to
    regular MySQL slaves
●   Slaves take read load (InnoDB/MyISAM)
●   Quick setup of new slaves (Cluster Online
    Backup)
●   Easy failover and fast recovery
http://johanandersson.blogspot.com/2009/05/ha-mysql-write-scaling-using-cluster-to.html
Galera Replication
●   Patch for InnoDB plus external library
●   Synchronous replication
●   Single- or multi-master
●   Multicast-Replication
●   HA plus load sharing possible
●   Certifikate-based replikation
    (instead of 2PC)
●   http://codership.com/products/mysql_galera
MMM
●   MySQL Master-Master Replication
    Manager
●   Perl-Script for monitoring, failover and
    management
●   Master-master replication configuration
    (one active writable master)
●   Failover by moving virtual IP-Address
●   Also supports read balancing
●   http://mysql-mmm.org/
Continuent Tungsten Replicator
●   Database-external solution
●   Asynchronous, Master-Slave, Fan-out &
    Fan-in
●   Java
●   Log-based
●   Events are stored in the Transaction History
    Log (THL)
●   Modular architekture (Pipelines, Stages)
●   http://continuent.com/community/tungsten-replicator
Red Hat Cluster Suite
●   HA and load balancing
●   Supports up to 16 nodes
●   Shared storage
●   Monitors services, file systems and network
    status
●   Fencing (STONITH) or distributed lock
    manager
●   Configuration synchronization
●   http://www.redhat.com/cluster_suite/
Solaris Cluster / OpenHA Cluster
●   Provides failover and scalability services
●   Solaris / OpenSolaris (Project Colorado)
●   Kernel-level components plus userland
●   Agents monitor applications
●   Geo Edition to provide Disaster Recovery
    using Replication
●   Open Source since June 2007
●   http://hub.opensolaris.org/bin/view/Community+Group+ha-clusters/WebHome
●   http://hub.opensolaris.org/bin/view/Project+ha-mysql/WebHome
Flipper
●   Perl Script managing pairs of MySQL
    servers replicating to each other.
●   Automatic switchover, triggered manually
●   Enables one half of the pair to be taken
    offline for maintenance work while other
    half carries on
●   Moves IP addresses based on a role ("read-
    only", "writable")
●   http://provenscaling.com/software/flipper/
Q&A




Questions, Comments?
Thank you!




Lenz Grimmer <lenz@grimmer.com>
         Twitter: @lenzgr
         http://lenzg.net/

More Related Content

PDF
MySQL High Availability Solutions
PDF
Ramp-Tutorial for MYSQL Cluster - Scaling with Continuous Availability
PDF
Choosing a MySQL High Availability solution - Percona Live UK 2011
PDF
The Full MySQL and MariaDB Parallel Replication Tutorial
PDF
Upgrade to MySQL 5.6 without downtime
PDF
MySQL Scalability and Reliability for Replicated Environment
PDF
Oracle to MySQL 2012
PDF
MySQL overview
MySQL High Availability Solutions
Ramp-Tutorial for MYSQL Cluster - Scaling with Continuous Availability
Choosing a MySQL High Availability solution - Percona Live UK 2011
The Full MySQL and MariaDB Parallel Replication Tutorial
Upgrade to MySQL 5.6 without downtime
MySQL Scalability and Reliability for Replicated Environment
Oracle to MySQL 2012
MySQL overview

What's hot (20)

PDF
M|18 Under the Hood: Galera Cluster
PDF
M|18 Why Abstract Away the Underlying Database Infrastructure
PDF
Demystifying MySQL Replication Crash Safety
PDF
MySQL Parallel Replication by Booking.com
PDF
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
PDF
MyRocks in MariaDB: why and how
PDF
Discard inport exchange table & tablespace
PDF
MySQL developing Store Procedure
PDF
Demystifying MySQL Replication Crash Safety
PDF
What's New in MySQL 5.7
PDF
Yahoo: Experiences with MySQL GTID and Multi Threaded Replication
PPTX
M|18 Writing Stored Procedures in the Real World
PDF
MySQL highav Availability
PPTX
MariaDB und mehr - MariaDB Roadshow Summer 2014 Hamburg Berlin Frankfurt
PDF
Webseminar: MariaDB Enterprise und MariaDB Enterprise Cluster
PDF
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
PPTX
The New MariaDB Offering: MariaDB 10, MaxScale and More
PDF
Online MySQL Backups with Percona XtraBackup
PPTX
MariaDB Enterprise & MariaDB Enterprise Cluster - MariaDB Webinar July 2014
PDF
UKOUG 2011: MySQL Architectures for Oracle DBA's
M|18 Under the Hood: Galera Cluster
M|18 Why Abstract Away the Underlying Database Infrastructure
Demystifying MySQL Replication Crash Safety
MySQL Parallel Replication by Booking.com
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
MyRocks in MariaDB: why and how
Discard inport exchange table & tablespace
MySQL developing Store Procedure
Demystifying MySQL Replication Crash Safety
What's New in MySQL 5.7
Yahoo: Experiences with MySQL GTID and Multi Threaded Replication
M|18 Writing Stored Procedures in the Real World
MySQL highav Availability
MariaDB und mehr - MariaDB Roadshow Summer 2014 Hamburg Berlin Frankfurt
Webseminar: MariaDB Enterprise und MariaDB Enterprise Cluster
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
The New MariaDB Offering: MariaDB 10, MaxScale and More
Online MySQL Backups with Percona XtraBackup
MariaDB Enterprise & MariaDB Enterprise Cluster - MariaDB Webinar July 2014
UKOUG 2011: MySQL Architectures for Oracle DBA's
Ad

Similar to MySQL High Availability Solutions (20)

PDF
Drupal Con My Sql Ha 2008 08 29
PDF
Buytaert kris my_sql-pacemaker
ODP
MySQL HA with PaceMaker
ODP
MySQL HA Alternatives 2010
PPTX
MySQL High Availibility Solutions
PDF
MySQL InnoDB Cluster HA Overview & Demo
PDF
Has MySQL grown up?
PPTX
MySQL High Availability Solutions - Feb 2015 webinar
PDF
Seminar : &quot;The Future of MySQL - Roadmap to Success&quot; session MySQL ...
PDF
Scaling MySQL -- Swanseacon.co.uk
PDF
MySQL高可用
PPT
Mysql high availability and scalability
PDF
1 architecture & design
PDF
Best practices for MySQL High Availability
PDF
High Availability with MySQL
ODP
MySQL HA
PPT
MySQL Alta Disponibilidade com Replicação
PPT
MySQL 5.6 Updates
PDF
Moodle Moot Spain: Moodle Available and Scalable with MySQL HA - InnoDB Clust...
PDF
Sunshine php my sql 8.0 v2
Drupal Con My Sql Ha 2008 08 29
Buytaert kris my_sql-pacemaker
MySQL HA with PaceMaker
MySQL HA Alternatives 2010
MySQL High Availibility Solutions
MySQL InnoDB Cluster HA Overview & Demo
Has MySQL grown up?
MySQL High Availability Solutions - Feb 2015 webinar
Seminar : &quot;The Future of MySQL - Roadmap to Success&quot; session MySQL ...
Scaling MySQL -- Swanseacon.co.uk
MySQL高可用
Mysql high availability and scalability
1 architecture & design
Best practices for MySQL High Availability
High Availability with MySQL
MySQL HA
MySQL Alta Disponibilidade com Replicação
MySQL 5.6 Updates
Moodle Moot Spain: Moodle Available and Scalable with MySQL HA - InnoDB Clust...
Sunshine php my sql 8.0 v2
Ad

More from Lenz Grimmer (20)

PDF
Ceph Management and Monitoring - DevConf.CZ - 2019-01-26
PDF
Managing and Monitoring Ceph - Ceph Day Berlin - 2018-11-12
PDF
Ceph Management and Monitoring with Dashboard V2 - Cephalocon 2018-03-23
PDF
Ceph and Storage Management with openATTIC - FOSDEM 2017-02-05
PDF
Ceph and Storage Management with openATTIC - Ceph Day Munich - 2016-09-23
PDF
Ceph and Storage Management in openATTIC - solutions.hamburg - 2016-09-09
PDF
Storage Monitoring in openATTIC - Monitoring Workshop - 2016-09-07
PDF
Ceph and Storage Management with openATTIC - FrOSCon 2016-08-21
PDF
Ceph and Storage Management with openATTIC - SUSE MOST - 2016-06-07
PDF
Ceph and Storage Management with openATTIC, Ceph Tech Talks 2016-06-23
PDF
Ceph and Storage Management with openATTIC, openSUSE Conference 2016-06-23
PDF
Storage Management mit openAttic - LinuxDay - 2015-11-21
PDF
Flexibles Storage Management unter Linux mit OpenATTIC - Kielux 2015-09-18
PDF
The Evolution of Storage on Linux - FrOSCon - 2015-08-22
PDF
MySQL 5.5 Replication Enhancements – An Overview (FOSDEM 2011)
PDF
What's new in MySQL 5.5? FOSDEM 2011
PDF
How to build your own Quadrocopter
PDF
What's new in MySQL 5.5?
PDF
ZFS unter Linux
PDF
Making MySQL Administration a Breeze - A look into a MySQL DBA's toolchest
Ceph Management and Monitoring - DevConf.CZ - 2019-01-26
Managing and Monitoring Ceph - Ceph Day Berlin - 2018-11-12
Ceph Management and Monitoring with Dashboard V2 - Cephalocon 2018-03-23
Ceph and Storage Management with openATTIC - FOSDEM 2017-02-05
Ceph and Storage Management with openATTIC - Ceph Day Munich - 2016-09-23
Ceph and Storage Management in openATTIC - solutions.hamburg - 2016-09-09
Storage Monitoring in openATTIC - Monitoring Workshop - 2016-09-07
Ceph and Storage Management with openATTIC - FrOSCon 2016-08-21
Ceph and Storage Management with openATTIC - SUSE MOST - 2016-06-07
Ceph and Storage Management with openATTIC, Ceph Tech Talks 2016-06-23
Ceph and Storage Management with openATTIC, openSUSE Conference 2016-06-23
Storage Management mit openAttic - LinuxDay - 2015-11-21
Flexibles Storage Management unter Linux mit OpenATTIC - Kielux 2015-09-18
The Evolution of Storage on Linux - FrOSCon - 2015-08-22
MySQL 5.5 Replication Enhancements – An Overview (FOSDEM 2011)
What's new in MySQL 5.5? FOSDEM 2011
How to build your own Quadrocopter
What's new in MySQL 5.5?
ZFS unter Linux
Making MySQL Administration a Breeze - A look into a MySQL DBA's toolchest

Recently uploaded (20)

PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
Architecture types and enterprise applications.pdf
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Hybrid model detection and classification of lung cancer
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Getting Started with Data Integration: FME Form 101
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
Zenith AI: Advanced Artificial Intelligence
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
DOCX
search engine optimization ppt fir known well about this
PDF
Five Habits of High-Impact Board Members
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
Developing a website for English-speaking practice to English as a foreign la...
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Assigned Numbers - 2025 - Bluetooth® Document
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
A novel scalable deep ensemble learning framework for big data classification...
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
WOOl fibre morphology and structure.pdf for textiles
Architecture types and enterprise applications.pdf
A comparative study of natural language inference in Swahili using monolingua...
Hybrid model detection and classification of lung cancer
Univ-Connecticut-ChatGPT-Presentaion.pdf
Getting Started with Data Integration: FME Form 101
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Zenith AI: Advanced Artificial Intelligence
Final SEM Unit 1 for mit wpu at pune .pptx
search engine optimization ppt fir known well about this
Five Habits of High-Impact Board Members
Group 1 Presentation -Planning and Decision Making .pptx
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Developing a website for English-speaking practice to English as a foreign la...

MySQL High Availability Solutions

  • 1. MySQL High Availability Solutions Lenz Grimmer <lenz@grimmer.com> < http://lenzg.net/ | Twitter: @lenzgr 2011-01-26 | San Francisco MySQL Meetup | USA
  • 2. $ whoami 1998 2002 2008 2010
  • 3. Agenda ● High Availability: Concepts & Considerations ● MySQL Replication ● DRBD / Pacemaker ● MySQL Cluster ● Other HA tools/applications
  • 4. Single MySQL Server MySQL Client SQL (SELECT, INSERT, UPDATE, DELETE) MySQL Storage Engines (InnoDB, MyISAM, PBXT...) Disk Storage (XFS, ReiserFS, JFS, ext3...)
  • 5. Why HA? ● Something can and will fail ● Service Maintenance ● Downtime is expensive ● Adding HA to an existing system is complex
  • 6. Elimination of the SPOF ● Identify what will fail eventually ● Hard disks ● Fans ● Consider what might fail ● Application crashes ● OOM-Situations, Kernel-Panics ● Network connections, Cables ● Power supply
  • 7. What is HA Clustering? ● Redundancy ● One system or service goes down → others take over ● IP address takeover, service takeover ● Ensuring data availability & integrity ● Not designed for high-performance
  • 9. Rules of High Availability ● Prepare for failure ● Aim to ensure that no important data is lost ● Keep it simple, stupid (KISS) ● Complexity is the enemy of reliability ● Automate it ● Test your setup frequently!
  • 10. HA Components ● Heartbeat ● Checks that services that are monitored, are alive. ● Can check individual servers, software services, networking etc. ● HA Monitor ● Configuration of the services ● Ensures proper shutdown and startup ● Allows manual control ● Shared storage / Replication
  • 11. Split-Brain ● Communications failures can lead to separated partitions of the cluster ● If those partitions each try and take control of the cluster, then it's called a split-brain condition ● If this happens, then bad things will happen ● Use Fencing or Moderation/Arbitration to avoid it
  • 12. Redundancy Using MySQL Replication MySQL Replication
  • 13. MySQL Replication ● Unidirectional ● Statement- or row-based (MySQL 5.1) ● Built into MySQL ● Easy to use and set up ● One Master, many Slaves ● Asynchronous – Slaves can lag behind ● New in MySQL 5.5: Semisync Replication
  • 14. MySQL Replication (2) ● Master maintains Binary logs & index ● Replication on Slave is single-threaded http://forge.mysql.com/wiki/ReplicationFeatures/ParallelSlave ● No automated fail-over ● No heartbeat, no monitoring ● New in 5.5: replication heartbeat
  • 15. MySQL Replication - Overview Read & Write Web/App Server Write Relay Log mysqld SQL I/O Threa Thread d Index & Binlogs Data Replication Binlog Data mysqld MySQL Master MySQL Slave
  • 16. Statement-based Replication ● Pro ✔ Proven (around since MySQL 3.23) ✔ Smaller log files ✔ Auditing of actual SQL statements ✔ No primary key requirement for replicated tables ● Con ✗ Non-deterministic functions and UDFs ✗ LOAD_FILE(), UUID(), CURRENT_USER(), FOUND_ROWS() (but RAND() and NOW() work)
  • 17. Row-based Replication ● Pro ✔ All changes can be replicated ✔ Similar technology used by other RDBMSes ✔ Fewer locks required for some INSERT, UPDATE or DELETE statements ● Con ✗ More data to be logged ✗ Log file size increases (backup/restore implications) ✗ Replicated tables require explicit primary keys ✗ Possible different result sets on bulk INSERTs
  • 18. Replication Topologies Master > Slave Master > Slaves Master > Slave > Slaves Masters > Slave (Multi-Source) Ring (Multi-Master) Master < > Master (Multi-Master)
  • 19. Master-Master Replication ● Two nodes are both master and slave to each other ● Useful for easier failover ● Not suitable for (write) load-balancing ● Don't write to both masters simultaneously! ● Use Sharding or Partitioning instead (e.g. MySQL Proxy)
  • 20. MySQL Replication as a HA Solution ● What happens if the Master fails? ● What happens if the Slave fails? ● This doesn’t sound like High Availability! ● Yes! ● Replication is only part of a HA configuration
  • 21. Pacemaker (Linux-HA) ● Supports 2 or more Nodes (v2) ● Resource monitoring (Apps and HW) ● Active fencing mechanism (STONITH) ● Node failure detection in seconds ● Supports many applications (incl. MySQL) ● http://clusterlabs.org/ ● http://www.clusterlabs.org/wiki/Load_Balanced_MySQL_Replicated_Cluster ● http://www.clusterlabs.org/wiki/DRBD_MySQL_HowTo
  • 22. Replication & HA ● Combined with Pacemaker ● Virtual IP takeover ● Slave gets promoted to Master ● Side benefits: load balancing & backup ● Can be tricky to fail back ● No automatic conflict resolution ● Proper failover needs to be scripted
  • 23. Redundancy With Disk Replication Disk Replication
  • 24. DRBD ● Distributed Replicated Block Device ● “RAID-1 over network” ● Synchronous/asynchronous block replication ● Automatic resynchronisation ● Application-agnostic ● Can mask local I/O-Errors ● Active/passive configuration ● Dual-primary mode (requires cluster file sytem like GFS or OCFS2) ● http://drbd.org/
  • 25. DRBD in Detail ● DRBD replicates data blocks between to block devices ● DRBD can be combined with Linux-HA and other HA solutions ● MySQL runs normally Applications on primary node ● MySQL is not active on Active Node Virtual IP Passive Node the secondary node ● DRBD is Linux only DRBD
  • 27. Replication vs. SAN ● Data Consistency / Integrity ● Synchronous vs. asynchronous ● SAN can become the SPOF ● Cold caches ● “Split brain”-Situations ● SAN/NAS I/O Overhead
  • 29. MySQL Cluster ● “Shared-nothing”-Architecture ● Automatic partitioning ● Distributed fragments ● Synchronous replication ● Fast, automatic fail-over of data nodes ● Automatic resynchronisation ● Transparent to MySQL applicationen ● Supports transactions ● http://mysql.com/products/database/cluster/
  • 30. MySQL Cluster ● In-memory indexes ● Not suitable for all query patterns (cross-table JOINs, range scans) ● No support for foreign keys ● Not suitable for long running transactions ● Network latency crucial ● Can be combined with MySQL replication (RBR)
  • 32. MySQL Cluster & Replikation ● MySQL Cluster ● Easy failover from one MySQL node to another ● Scaling write load using multiple SQL nodes ● Asynchronous replication from Cluster to regular MySQL slaves ● Slaves take read load (InnoDB/MyISAM) ● Quick setup of new slaves (Cluster Online Backup) ● Easy failover and fast recovery
  • 34. Galera Replication ● Patch for InnoDB plus external library ● Synchronous replication ● Single- or multi-master ● Multicast-Replication ● HA plus load sharing possible ● Certifikate-based replikation (instead of 2PC) ● http://codership.com/products/mysql_galera
  • 35. MMM ● MySQL Master-Master Replication Manager ● Perl-Script for monitoring, failover and management ● Master-master replication configuration (one active writable master) ● Failover by moving virtual IP-Address ● Also supports read balancing ● http://mysql-mmm.org/
  • 36. Continuent Tungsten Replicator ● Database-external solution ● Asynchronous, Master-Slave, Fan-out & Fan-in ● Java ● Log-based ● Events are stored in the Transaction History Log (THL) ● Modular architekture (Pipelines, Stages) ● http://continuent.com/community/tungsten-replicator
  • 37. Red Hat Cluster Suite ● HA and load balancing ● Supports up to 16 nodes ● Shared storage ● Monitors services, file systems and network status ● Fencing (STONITH) or distributed lock manager ● Configuration synchronization ● http://www.redhat.com/cluster_suite/
  • 38. Solaris Cluster / OpenHA Cluster ● Provides failover and scalability services ● Solaris / OpenSolaris (Project Colorado) ● Kernel-level components plus userland ● Agents monitor applications ● Geo Edition to provide Disaster Recovery using Replication ● Open Source since June 2007 ● http://hub.opensolaris.org/bin/view/Community+Group+ha-clusters/WebHome ● http://hub.opensolaris.org/bin/view/Project+ha-mysql/WebHome
  • 39. Flipper ● Perl Script managing pairs of MySQL servers replicating to each other. ● Automatic switchover, triggered manually ● Enables one half of the pair to be taken offline for maintenance work while other half carries on ● Moves IP addresses based on a role ("read- only", "writable") ● http://provenscaling.com/software/flipper/
  • 41. Thank you! Lenz Grimmer <lenz@grimmer.com> Twitter: @lenzgr http://lenzg.net/